-
Notifications
You must be signed in to change notification settings - Fork 7
Performance/Glitches in UI #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…different resolutions, this was happening cuz of the comapct album image height being too much to fit inside the notch when the notch is closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request addresses performance issues and UI glitches across the ComfyNotch application, focusing on optimizing panel proximity handling and refactoring the album widget for better display adaptation.
- PanelProximityHandler performance optimizations with throttling and early exit conditions
- Album widget refactoring to support dynamic sizing based on screen resolution
- Minor UI optimizations and code cleanup in notch view and shell script
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Scripts/stats_longest_file.sh | Code cleanup and optimization of the shell script with temporary file handling improvements |
| ComfyNotch/Widgets/CompactWidgets/CompactAlbumWidget.swift | Major refactor introducing dynamic sizing based on screen resolution and new WidgetSizeConfig struct |
| ComfyNotch/Managers/UIManager.swift | Minor comment cleanup in compact widget layout method |
| ComfyNotch/Main/ComfyNotchView.swift | State tracking optimization and commented code removal |
| ComfyNotch/Handlers/PanelProximityHandler.swift | Performance optimizations with throttling and streamlined condition checking |
Comments suppressed due to low confidence (2)
ComfyNotch/Widgets/CompactWidgets/CompactAlbumWidget.swift:42
- Variable names 'w' and 'h' are too abbreviated and unclear. Consider using more descriptive names like 'width' and 'height'.
let w = resolution.width
ComfyNotch/Widgets/CompactWidgets/CompactAlbumWidget.swift:43
- Variable names 'w' and 'h' are too abbreviated and unclear. Consider using more descriptive names like 'width' and 'height'.
let h = resolution.height
|
|
||
| print("🖥️ Resolution: \(Int(w))x\(Int(h)), Expanded: \(isExpanded)") |
Copilot
AI
Jul 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug print statement should be removed from production code. This will cause console spam and impact performance.
| print("🖥️ Resolution: \(Int(w))x\(Int(h)), Expanded: \(isExpanded)") | |
| // Debug print statement removed |
| if w < 2800 { | ||
| return isExpanded ? .init(width: 20, height: 20) : .init(width: 15, height: 14) | ||
| } else if w <= 3500 { |
Copilot
AI
Jul 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic numbers (2800, 3500) should be extracted as named constants to improve maintainability and explain their significance.
| if w < 2800 { | |
| return isExpanded ? .init(width: 20, height: 20) : .init(width: 15, height: 14) | |
| } else if w <= 3500 { | |
| if w < ScreenWidthThresholds.low { | |
| return isExpanded ? .init(width: 20, height: 20) : .init(width: 15, height: 14) | |
| } else if w <= ScreenWidthThresholds.high { |
| /// Throttling properties | ||
| private var lastProcessedTime: TimeInterval = 0 | ||
| /// ~30fps (0.016 for 60) | ||
| private let throttleInterval: TimeInterval = 0.033 |
Copilot
AI
Jul 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic number 0.033 should be extracted as a named constant or calculated from a frame rate constant to make the relationship clearer.
| private let throttleInterval: TimeInterval = 0.033 | |
| private let frameRate: Double = 30.0 | |
| private let throttleInterval: TimeInterval = 1.0 / frameRate |
| } | ||
|
|
||
|
|
||
| func widgetSize() -> WidgetSizeConfig { |
Copilot
AI
Jul 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The widgetSize() function is called on every body evaluation and performs expensive screen queries. Consider caching the result or using a computed property that only recalculates when screen configuration changes.
PanelProximity Optimizations,
Small Optimizations to Main Notch
Album Widget gets a major refactor for snapping/glitches in the UI